package com.example.youmishoppingmall.mapper;

import com.example.youmishoppingmall.bean.Cart;
import com.example.youmishoppingmall.bean.CartEx;
import com.example.youmishoppingmall.bean.CartExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

public interface CartMapper {

    @Select("select cart.*,user.nickname,goods.name from cart,`user`,goods where user.id=user_id and goods.id=goods_id")
    @Results(id = "CartMap", value = {
            @Result(property = "id", column = "id", id = true),
            @Result(property = "userId", column = "user_id"),
            @Result(property = "goodsId", column = "goods_id"),
            @Result(property = "goodsNum", column = "goods_num"),
            @Result(property = "note", column = "note") ,
            @Result(property = "userName", column = "nickname"),
            @Result(property = "goodsName", column = "name")
    })
    List<CartEx> getAll();

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cart
     *
     * @mbg.generated Tue Sep 27 09:55:08 CST 2022
     */
    long countByExample(CartExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cart
     *
     * @mbg.generated Tue Sep 27 09:55:08 CST 2022
     */
    int deleteByExample(CartExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cart
     *
     * @mbg.generated Tue Sep 27 09:55:08 CST 2022
     */
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cart
     *
     * @mbg.generated Tue Sep 27 09:55:08 CST 2022
     */
    int insert(Cart record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cart
     *
     * @mbg.generated Tue Sep 27 09:55:08 CST 2022
     */
    int insertSelective(Cart record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cart
     *
     * @mbg.generated Tue Sep 27 09:55:08 CST 2022
     */
    List<Cart> selectByExample(CartExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cart
     *
     * @mbg.generated Tue Sep 27 09:55:08 CST 2022
     */
    Cart selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cart
     *
     * @mbg.generated Tue Sep 27 09:55:08 CST 2022
     */
    int updateByExampleSelective(@Param("record") Cart record, @Param("example") CartExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cart
     *
     * @mbg.generated Tue Sep 27 09:55:08 CST 2022
     */
    int updateByExample(@Param("record") Cart record, @Param("example") CartExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cart
     *
     * @mbg.generated Tue Sep 27 09:55:08 CST 2022
     */
    int updateByPrimaryKeySelective(Cart record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cart
     *
     * @mbg.generated Tue Sep 27 09:55:08 CST 2022
     */
    int updateByPrimaryKey(Cart record);
}